package com.lyf.scm.plan.insfrastructure.db.mapper;

import com.lyf.scm.plan.api.dto.OperationLogRecordDTO;
import com.lyf.scm.plan.insfrastructure.db.dataobject.OperationLogRecordDO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 操作日志记录表
 *
 * @author wangchlei
 * @date 2020/09/25
 */
public interface OperationLogRecordMapper {
    /**
     * 新增大数据错误日志
     *
     * @param operationLogRecordDO
     * @return {@link Integer}
     **/
    Integer addBigDataErrorLog(OperationLogRecordDO operationLogRecordDO);

    /**
     * 批量新增大数据错误日志
     *
     * @param operationLogRecordDOs
     * @return void
     **/
    void batchAddBigDataErrorLog(List<OperationLogRecordDO> operationLogRecordDOs);


    /**
     * 批量新增数据来源日志
     *
     * @param operationLogRecordDOs
     * @return void
     **/
    void batchAddOperationLogRecord(List<OperationLogRecordDO> operationLogRecordDOs);

    /**
     * 拉取补救信息,时间在9点以后，23点以前
     *
     * @param startTime
     * @param endTime
     * @return {@link List<OperationLogRecordDO>}
     **/
    List<OperationLogRecordDO> pullRemedialLog(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("scope") Integer scope,@Param("opStatus") Integer opStatus);

    Integer deleteBigDataErrorLog(@Param("opSource") Integer opSource, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("opSign") String opSign);

    /**
     * 查询操作日志
     *
     * @param operationDo
     * @return
     */
    List<OperationLogRecordDO> getOperationLogs(OperationLogRecordDO operationDo);

    /**
     * 新增操作日志数据
     *
     * @param operationDo
     */
    void insertOperationLog(OperationLogRecordDO operationDo);

    /**
     * 编辑操作日志数据
     * @author wuyuanhang
     * @date 2020/11/16
     * @param operationDo 操作日志对象
     * @return int 更新条数
     */
    int updateOperationLog(OperationLogRecordDO operationDo);

    /**
     * 修改操作日志状态
     *
     * @param operationDo
     */
    void updateOperationLogStatus(OperationLogRecordDO operationDo);

    List<OperationLogRecordDO> pullReasonableLog(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("scope") Integer scope);

    int updateInitiatedStatus(OperationLogRecordDO item);

    int deleteById(@Param("id") Long id);

    void batchUpdateBigDataErrorLog(@Param("operationLogRecordDOs") List<OperationLogRecordDO> operationLogRecordDOs,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

    void updateBigDataErrorLog(@Param("operationLogRecordDO") OperationLogRecordDO operationLogRecordDO,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

    int updateStatusById(Long id);

    void batchUpdateOperationLogStatus(List<OperationLogRecordDO> operationLogRecordDOs);

    /**
     * 修改操作标识状态为已删除
     *
     * @param opSign
     */
    void updateToDel(@Param("opSign") String opSign);
}
